:root {
    --talon-green: #1a3a32;
    --green: #203c26;
    --white: #ffffff;
    --lightgreen: #2c5234;
    --accent: #8B4513;
    --correct-green: #6d9673;
    --error-red: #a34a4a;
    --tile-size: 40px;
    --tile-max-size: 40px;
}

/* 1. Main Layout */
.game-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 20px 50px 20px;
    font-family: 'Georgia', serif;
    margin-top: 30px;
    margin-bottom: 30px;

}

.game-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 2. Master Password Section (Top) */
.master-section {
    background: var(--green);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #ddd;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.master-password-box {
    margin-top: 20px;
    padding: 20px;
    background: var(--green);
    border-radius: 8px;
    transition: all 0.4s ease;
}

.master-password-box h3 {
    text-align: center;
    color: var(--white);
    font-size: 2rem;
    margin-bottom: 30px;
}

.password-grid {
    display: flex;
    flex-wrap: nowrap; 
    gap: 4px;
    justify-content: center;
    width: 100%;
    overflow-x: auto;
    padding: 5px;
}

.hidden {
    display: none !important;
}

/* 3. Clues Grid (2-Wide) */
.clues-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 Wide */
    gap: 20px;
}

.clue-card {
    background: var(--lightgreen);
    padding: 20px;
    border-radius: 8px;
    border-left: 6px solid var(--accent); /* Brown accent for style */
    box-shadow: 2px 4px 12px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.clue-card p {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 15px;
    color: var(--white);
    font-weight: 500;
}

/* 4. The Tiles */
.slot-wrapper {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tile {
    touch-action: manipulation;
    flex: 0 1 var(--tile-max-size);
    aspect-ratio: 1 / 1;
    min-width: 25px;
    font-size: clamp(1rem, 4vw, 1.4rem);
    background: white;
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: bold;
    font-family: Georgia, 'Times New Roman', Times, serif;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    border-radius: 4px;
}

.tile.master-tile {
    border-bottom: 4px solid var(--talon-green);
    background-color: #fffdf5;
}

.tile.selected {
    border: 3px solid var(--talon-green);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    z-index: 5;
}

.tile.correct {
    background-color: var(--correct-green);
    color: white;
    border-color: var(--correct-green);
}

.tile.incorrect {
    background-color: var(--error-red);
    color: white;
    border-color: var(--error-red);
}

.tile-space {
    width: 20px;
}

/* 5. Controls & Buttons */
.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.submit-btn { background-color: var(--correct-green); color: var(--white); } /* Gold for Submit */
.clear-btn { background-color: #666; }
.restart-btn { background-color: var(--error-red); }

/* 7. Alerts */
.alert-container {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
}

.alert {
    background: white;
    color: var(--talon-green);
    padding: 15px 30px;
    border-radius: 8px;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 2px solid var(--talon-green);
    text-align: center;
    margin-bottom: 15px;
}

.alert.hide {
    opacity: 0;
    outline: none;
}

/* 8. Mobile Responsiveness */
@media (max-width: 850px) {
    .clues-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .game-wrapper {
        padding-left: 10px;
        padding-right: 10px;
    }

    .tile {
        flex: 1 1 32px; 
        max-width: 32px; 
        min-width: 20px;
        aspect-ratio: 1 / 1;
        font-size: 1rem;
        border-width: 1.5px;
    }

    .slot-wrapper, .password-grid {
        display: flex;
        flex-wrap: nowrap;
        gap: 2px;
        justify-content: center;
        width: 100%;
        overflow: hidden;
    }

    .tile-space {
        width: 8px; 
        flex-shrink: 0;
    }

    .clue-card p {
        font-size: 0.95rem;
    }
}